public class Singleton {
    // 私有静态实例
    private static volatile Singleton instance;
    
    // 私有构造函数
    private Singleton() {}
    
    // 公共获取实例方法
    public static Singleton getInstance() {
        if (instance == null) {
            synchronized (Singleton.class) {
                if (instance == null) {
                    instance = new Singleton();
                }
            }
        }
        return instance;
    }
    
    public void doSomething() {
        System.out.println("单例模式示例方法");
    }
} 